<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        new Promise((resolve, reject) => {
            console.log('请求A数据');
            try {
                // throw new Error('错误')
                setTimeout(() => {
                    const data = {
                        name: '童康'
                    }
                    resolve(data)
                    console.log('A数据请求成功');
                }, 1500);
            } catch (e) {
                reject('A请求失败')
            }

        })
            .then((value) => {
                return new Promise((resolve, reject) => {
                    try {
                        // throw new Error('错误')
                        console.log('请求B数据')
                        setTimeout(() => {
                            const data = {
                                age: 24
                            }
                            resolve({ ...value, ...data })
                            console.log('B数据请求成功');
                        }, 1500);
                    } catch (e) {
                        reject('B请求失败')
                    }

                })

            })
            .then((value) => {
                try {
                    // throw new Error('错误')
                    console.log('请求C数据')
                    return new Promise((resolve, reject) => {
                        setTimeout(() => {
                            const data = {
                                sex: '男'
                            }
                            resolve({ ...value, ...data })
                            console.log('C数据请求成功');
                        }, 1500);
                    })
                } catch (e) {
                    reject('C请求失败')
                }

            })
            .then((value) => {
                console.log(value);
            })
            .catch((reason) => {
                console.log(reason);
            })
    </script>
</body>

</html>